<style scoped>
page {
	background-color: #f4f5fa !important;
}
.childHomeBox{
	border-radius: 12px;
}
.textIcon{
	width: 32rpx;
	height: 32rpx;
}
.textIconPhone{
	width: 30rpx;
	height: 30rpx;
}
.titleLeft{
	position: relative;
}
.titleLeft::before{
	content: ' ';
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 34rpx;
	border: 6rpx;
	border-left: 3px solid #0089fe;
}
.childHomeBox .content{
	font-size: 28rpx;
	color:#999;
}
.btnBlue{
	width: 60%;
	height: 40px;
	line-height: 40px;
	background-color: #0089fe;
	font-size: 36rpx;
	color: #FFFFFF;
}
</style>
<template>
	<view class="page container">
		<!-- 轮播图开始 -->
		<view class="banner-box mar-t-12 over-hide" style="height: 152px !important;">
			<swiper
				style="height: 100% !important;"
				indicator-color="#d5d5d5"
				indicator-active-color="#ffffff"
				:indicator-dots="true"
				:autoplay="autoplay"
				:interval="interval"
				:duration="duration"
			>
				<swiper-item class="flex-column flex-1" style="height: 100% !important;" v-for="(item,index) in banners" :key="index" @click="previewImage(banners,index)">
					<image  class="banner-item" style="height: 100% !important;" :src="item.image" mode="widthFix" lazy-load='true'></image>
				</swiper-item>
			</swiper>
		</view>
		<!-- 轮播图结束 -->
		<view class="childHomeBox bac-color-fff pad-12 mar-t-12">
			<view class="title font-color-333 font-size-18 font-bold">
				我是儿童之家名称
			</view>
			<view class="flex align-center mar-t-10">
				<image class="textIcon" src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-767674fd-0f0e-4801-90e6-bef27c2e36df/714735ef-22e0-41b7-8f15-241a85180fff.png" mode=""></image>
				<text class="font-size-12 font-color-888 mar-l-5">我是地址我是地址我是地址我是地址我是地址我是地址</text>
			</view>
			<view class="flex align-center mar-t-10">
				<image class="textIconPhone" src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-767674fd-0f0e-4801-90e6-bef27c2e36df/10bde43c-79f5-4655-8cdf-7aca0a2c6f1a.png" mode=""></image>
				<text class="font-size-12 font-color-888 mar-l-5">0577-6655566</text>
			</view>
		</view>
		<view class="childHomeBox bac-color-fff pad-12 mar-t-12">
			<view class="title titleLeft pad-l-10 font-color-333 font-size-18 font-bold">
				介绍
			</view>
			<view class="content mar-t-10">
				我是介绍内容
			</view>
		</view>
		<view class="childHomeBox bac-color-fff pad-12 mar-t-12" style="margin-bottom: 70px;">
			<view class="title titleLeft pad-l-10 font-color-333 font-size-18 font-bold">
				活动记录
			</view>
			<view class="content mar-t-10">
				<list-item :list="listCatchData[0]" :load="load[0]" @listloadmore="listloadmore" @refreshList="refreshList"></list-item>
			</view>
		</view>
		<view class="pad-10 w-100 bac-color-fff box-b" style="position: fixed; bottom: 0;">
			<button class="btnBlue" @click="actRecordBtn">上传记录</button>
		</view>
	</view>
</template>

<script>
import { myHelpdetail } from '@/utils/http';
import listItem from '@/components/list/list-item-child-home-act.vue'

export default {
	components: {
		listItem
	},
	data() {
		return {
			autoplay: true,
			interval:6000,
			duration:500,
			banners:[{
				id:0,
				image:'https://cnxfljj.cncn.gov.cn/uploads/20220109/3af40bddcc566d65fbe3fc18a198463a.jpg'
			}],
			bannerImgs:[],
			listCatchData:{
				0:[{
					id:0,
					title:1,
					num:1,
					time:'2022-02-02'
				},{
					id:1,
					title:1,
					num:2,
					time:'2022-02-02'
				},{
					id:1,
					title:1,
					num:2,
					time:'2022-02-02'
				},{
					id:1,
					title:1,
					num:2,
					time:'2022-02-02'
				}]
			},
			load:{},
			pageSize:16,
			loading:false,
		};
	},
	onLoad(option) {
		this.id = option.id;
		// this.myHelpdetail();
		// this.helpLog();
		// this.bus.$on('refreshHelpLog',()=>{
		// 	console.log('bus.on refreshHelpLog')
		// 	this.index_page = 0
		// 	this.list = []
		// 	this.helpLog();
		// })
	},
	methods: {
		actRecordBtn(){
			this.href('/pages/social/actRecordSubmit')
		},
		myHelpdetail() {
			myHelpdetail({ id: this.id }).then(res => {
				console.log(res);
				this.info = res;
			});
		},
		refreshList(current) {
			this.listCatchData = {}
			this.$set(this.listCatchData,current,[])
			this.load = {}
			this.getList(current)
		},
		listloadmore(val){
			if(this.load[this.tabIndex].loading === 'noMore') return
			this.load[this.tabIndex].page++
			this.getList(this.tabIndex)
		},
		getList(current) {
			if(!this.load[current]){
				this.load[current] = {
					page:1,
					loading:'loading'
				}
			}
			const params = {
				audit_status:current,
				page:this.load[current].page,
				num:this.pageSize
			}
			if(current==0){
				delete params.audit_status
			}
			console.log('params',params)
			this.loading = true
			socialHome(params).then(res => {
				//如果没数据了
				if(data&&(data.length === 0 || data.length < this.pageSize)){
					
				}
				let oldList = this.listCatchData[current] || []
				oldList.push(...data)
				this.$set(this.listCatchData,current,oldList)
			}).finally(()=>{
				this.loading = false
			})
		},
	}
};
</script>


